<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta charset="utf-8" />
    <title>Form Elements - Ace Admin</title>

    <meta name="description" content="Common form elements and layouts" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

    <!-- bootstrap & fontawesome -->
    <link rel="stylesheet" href="__PUBLIC__/Admin/assets/css/bootstrap.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/Admin/assets/font-awesome/4.5.0/css/font-awesome.min.css" />

    <!-- page specific plugin styles -->
    <link rel="stylesheet" href="__PUBLIC__/Admin/assets/css/jquery-ui.custom.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/Admin/assets/css/chosen.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/Admin/assets/css/bootstrap-datepicker3.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/Admin/assets/css/bootstrap-timepicker.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/Admin/assets/css/daterangepicker.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/Admin/assets/css/bootstrap-datetimepicker.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/Admin/assets/css/bootstrap-colorpicker.min.css" />

    <!-- text fonts -->
    <link rel="stylesheet" href="__PUBLIC__/Admin/assets/css/fonts.googleapis.com.css" />

    <!-- ace styles -->
    <link rel="stylesheet" href="__PUBLIC__/Admin/assets/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style" />

    <!--[if lte IE 9]>
      <link rel="stylesheet" href="__PUBLIC__/Admin/assets/css/ace-part2.min.css" class="ace-main-stylesheet" />
    <![endif]-->
    <link rel="stylesheet" href="__PUBLIC__/Admin/assets/css/ace-skins.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/Admin/assets/css/ace-rtl.min.css" />

    <!--[if lte IE 9]>
      <link rel="stylesheet" href="__PUBLIC__/Admin/assets/css/ace-ie.min.css" />
    <![endif]-->

    <!-- inline styles related to this page -->

    <!-- ace settings handler -->
    <script src="__PUBLIC__/Admin/assets/js/ace-extra.min.js"></script>

    <!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

    <!--[if lte IE 8]>
    <script src="__PUBLIC__/Admin/assets/js/html5shiv.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/respond.min.js"></script>
    <![endif]-->
  </head>

  <body class="no-skin">
   <include file="Public/header" />
    <!-- /.header -->
    <div class="main-container ace-save-state" id="main-container">
      <script type="text/javascript">
        try{ace.settings.loadState('main-container')}catch(e){}
      </script>

      <div id="sidebar" class="sidebar                  responsive                    ace-save-state">
        <script type="text/javascript">
          try{ace.settings.loadState('sidebar')}catch(e){}
        </script>

        <div class="sidebar-shortcuts" id="sidebar-shortcuts">
          <div class="sidebar-shortcuts-large" id="sidebar-shortcuts-large">
            <button class="btn btn-success">
              <i class="ace-icon fa fa-signal"></i>
            </button>

            <button class="btn btn-info">
              <i class="ace-icon fa fa-pencil"></i>
            </button>

            <button class="btn btn-warning">
              <i class="ace-icon fa fa-users"></i>
            </button>

            <button class="btn btn-danger">
              <i class="ace-icon fa fa-cogs"></i>
            </button>
          </div>

          <div class="sidebar-shortcuts-mini" id="sidebar-shortcuts-mini">
            <span class="btn btn-success"></span>

            <span class="btn btn-info"></span>

            <span class="btn btn-warning"></span>

            <span class="btn btn-danger"></span>
          </div>
        </div><!-- /.sidebar-shortcuts -->

        <include file="Public/navlist" />
        <!-- /.nva-list -->

        <div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
          <i id="sidebar-toggle-icon" class="ace-icon fa fa-angle-double-left ace-save-state" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
        </div>
      </div>

      <div class="main-content">
        <div class="main-content-inner">
          <div class="breadcrumbs ace-save-state" id="breadcrumbs">
            <ul class="breadcrumb">
              <li>
                <i class="ace-icon fa fa-home home-icon"></i>
                <a href="#">Home</a>
              </li>

              <li>
                <a href="#">Forms</a>
              </li>
              <li class="active">Form Elements</li>
            </ul><!-- /.breadcrumb -->

            <div class="nav-search" id="nav-search">
              <form class="form-search">
                <span class="input-icon">
                  <input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
                  <i class="ace-icon fa fa-search nav-search-icon"></i>
                </span>
              </form>
            </div><!-- /.nav-search -->
          </div>

          <div class="page-content">
            <div class="ace-settings-container" id="ace-settings-container">
              <div class="btn btn-app btn-xs btn-warning ace-settings-btn" id="ace-settings-btn">
                <i class="ace-icon fa fa-cog bigger-130"></i>
              </div>

              <div class="ace-settings-box clearfix" id="ace-settings-box">
                <div class="pull-left width-50">
                  <div class="ace-settings-item">
                    <div class="pull-left">
                      <select id="skin-colorpicker" class="hide">
                        <option data-skin="no-skin" value="#438EB9">#438EB9</option>
                        <option data-skin="skin-1" value="#222A2D">#222A2D</option>
                        <option data-skin="skin-2" value="#C6487E">#C6487E</option>
                        <option data-skin="skin-3" value="#D0D0D0">#D0D0D0</option>
                      </select>
                    </div>
                    <span>&nbsp; Choose Skin</span>
                  </div>

                  <div class="ace-settings-item">
                    <input type="checkbox" class="ace ace-checkbox-2 ace-save-state" id="ace-settings-navbar" autocomplete="off" />
                    <label class="lbl" for="ace-settings-navbar"> Fixed Navbar</label>
                  </div>

                  <div class="ace-settings-item">
                    <input type="checkbox" class="ace ace-checkbox-2 ace-save-state" id="ace-settings-sidebar" autocomplete="off" />
                    <label class="lbl" for="ace-settings-sidebar"> Fixed Sidebar</label>
                  </div>

                  <div class="ace-settings-item">
                    <input type="checkbox" class="ace ace-checkbox-2 ace-save-state" id="ace-settings-breadcrumbs" autocomplete="off" />
                    <label class="lbl" for="ace-settings-breadcrumbs"> Fixed Breadcrumbs</label>
                  </div>

                  <div class="ace-settings-item">
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-rtl" autocomplete="off" />
                    <label class="lbl" for="ace-settings-rtl"> Right To Left (rtl)</label>
                  </div>

                  <div class="ace-settings-item">
                    <input type="checkbox" class="ace ace-checkbox-2 ace-save-state" id="ace-settings-add-container" autocomplete="off" />
                    <label class="lbl" for="ace-settings-add-container">
                      Inside
                      <b>.container</b>
                    </label>
                  </div>
                </div><!-- /.pull-left -->

                <div class="pull-left width-50">
                  <div class="ace-settings-item">
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-hover" autocomplete="off" />
                    <label class="lbl" for="ace-settings-hover"> Submenu on Hover</label>
                  </div>

                  <div class="ace-settings-item">
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-compact" autocomplete="off" />
                    <label class="lbl" for="ace-settings-compact"> Compact Sidebar</label>
                  </div>

                  <div class="ace-settings-item">
                    <input type="checkbox" class="ace ace-checkbox-2" id="ace-settings-highlight" autocomplete="off" />
                    <label class="lbl" for="ace-settings-highlight"> Alt. Active Item</label>
                  </div>
                </div><!-- /.pull-left -->
              </div><!-- /.ace-settings-box -->
            </div><!-- /.ace-settings-container -->

            <div class="page-header">
              <h1>
                发布一篇博文
              </h1>
            </div><!-- /.page-header -->

            <div class="row">
              <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->
                <form class="form-horizontal" role="form" method="post" action="{:U('Article/articleAdd')}" id="article-add" enctype="multipart/form-data">
                  <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1">文章标题</label>

                    <div class="col-sm-9">
                      <input type="text" id="form-field-1" placeholder="文章标题" class="col-xs-10 col-sm-5" name="article_title"/>
                    </div>
                  </div>

                  <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1">文章头图</label>
                    <div class="col-xs-3">
                      <input multiple="" type="file" id="id-input-file-3" name="article_img"/>
                    </div>
                  </div>

                  <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1-1">文章排序 </label>

                    <div class="col-sm-9">
                      <input type="text" id="spinner1" value="250" name="sort"/>     
                    </div>
                  </div>

                  <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1-1">是否显示</label>
                    <div class="col-sm-3">
                    <label style="padding-top: 7px;">
                      <input name="is_display" class="ace ace-switch ace-switch-6" type="checkbox" checked="checked" value="1" />
                      <span class="lbl"></span>
                    </label>
                    </div>
                  </div>
                <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->
                <h4 class="header green clearfix">
                  编辑文章内容
                  <span class="block pull-right">
                    <small class="grey middle">选择样式: &nbsp;</small>

                    <span class="btn-toolbar inline middle no-margin">
                      <span data-toggle="buttons" class="btn-group no-margin">
                        <label class="btn btn-sm btn-yellow">
                          1
                          <input type="radio" value="1" />
                        </label>

                        <label class="btn btn-sm btn-yellow active">
                          2
                          <input type="radio" value="2" />
                        </label>

                        <label class="btn btn-sm btn-yellow">
                          3
                          <input type="radio" value="3" />
                        </label>

                        <label class="btn btn-sm btn-yellow">
                          4
                          <input type="radio" value="4" />
                        </label>
                      </span>
                    </span>
                  </span>
                </h4>

                <div class="wysiwyg-editor" id="editor1"></div>
                <input type="hidden" name="article_content" value="" />
                <div class="hr hr-double dotted"></div>
                <!-- PAGE CONTENT ENDS -->
                </div>
                <div class="col-xs-12">
                  <p>
                    <button class="btn btn-success btn-block">提交</button>
                  </p>
                </div>
                <!-- /.col -->
                <!--< div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                      <button class="btn btn-info" type="button">
                        <i class="ace-icon fa fa-check bigger-110"></i>
                        提交
                      </button>

                      &nbsp; &nbsp; &nbsp;
                      <button class="btn" type="reset">
                        <i class="ace-icon fa fa-undo bigger-110"></i>
                        重置
                      </button>
                    </div>
                  </div> -->
                </form>
                <div id="modal-form" class="modal" tabindex="-1">
                  <div class="modal-dialog">
                    <div class="modal-content">
                      <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h4 class="blue bigger">Please fill the following form fields</h4>
                      </div>

                      <div class="modal-body">
                        <div class="row">
                          <div class="col-xs-12 col-sm-5">
                            <div class="space"></div>

                            <input type="file" />
                          </div>

                          <div class="col-xs-12 col-sm-7">
                            <div class="form-group">
                              <label for="form-field-select-3">Location</label>

                              <div>
                                <select class="chosen-select" data-placeholder="Choose a Country...">
                                  <option value="">&nbsp;</option>
                                  <option value="AL">Alabama</option>
                                  <option value="AK">Alaska</option>
                                  <option value="AZ">Arizona</option>
                                  <option value="AR">Arkansas</option>
                                  <option value="CA">California</option>
                                  <option value="CO">Colorado</option>
                                  <option value="CT">Connecticut</option>
                                  <option value="DE">Delaware</option>
                                  <option value="FL">Florida</option>
                                  <option value="GA">Georgia</option>
                                  <option value="HI">Hawaii</option>
                                  <option value="ID">Idaho</option>
                                  <option value="IL">Illinois</option>
                                  <option value="IN">Indiana</option>
                                  <option value="IA">Iowa</option>
                                  <option value="KS">Kansas</option>
                                  <option value="KY">Kentucky</option>
                                  <option value="LA">Louisiana</option>
                                  <option value="ME">Maine</option>
                                  <option value="MD">Maryland</option>
                                  <option value="MA">Massachusetts</option>
                                  <option value="MI">Michigan</option>
                                  <option value="MN">Minnesota</option>
                                  <option value="MS">Mississippi</option>
                                  <option value="MO">Missouri</option>
                                  <option value="MT">Montana</option>
                                  <option value="NE">Nebraska</option>
                                  <option value="NV">Nevada</option>
                                  <option value="NH">New Hampshire</option>
                                  <option value="NJ">New Jersey</option>
                                  <option value="NM">New Mexico</option>
                                  <option value="NY">New York</option>
                                  <option value="NC">North Carolina</option>
                                  <option value="ND">North Dakota</option>
                                  <option value="OH">Ohio</option>
                                  <option value="OK">Oklahoma</option>
                                  <option value="OR">Oregon</option>
                                  <option value="PA">Pennsylvania</option>
                                  <option value="RI">Rhode Island</option>
                                  <option value="SC">South Carolina</option>
                                  <option value="SD">South Dakota</option>
                                  <option value="TN">Tennessee</option>
                                  <option value="TX">Texas</option>
                                  <option value="UT">Utah</option>
                                  <option value="VT">Vermont</option>
                                  <option value="VA">Virginia</option>
                                  <option value="WA">Washington</option>
                                  <option value="WV">West Virginia</option>
                                  <option value="WI">Wisconsin</option>
                                  <option value="WY">Wyoming</option>
                                </select>
                              </div>
                            </div>

                            <div class="space-4"></div>

                            <div class="form-group">
                              <label for="form-field-username">Username</label>

                              <div>
                                <input type="text" id="form-field-username" placeholder="Username" value="alexdoe" />
                              </div>
                            </div>

                            <div class="space-4"></div>

                            <div class="form-group">
                              <label for="form-field-first">Name</label>

                              <div>
                                <input type="text" id="form-field-first" placeholder="First Name" value="Alex" />
                                <input type="text" id="form-field-last" placeholder="Last Name" value="Doe" />
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>

                      <div class="modal-footer">
                        <button class="btn btn-sm" data-dismiss="modal">
                          <i class="ace-icon fa fa-times"></i>
                          Cancel
                        </button>

                        <button class="btn btn-sm btn-primary">
                          <i class="ace-icon fa fa-check"></i>
                          Save
                        </button>
                      </div>
                    </div>
                  </div>
                </div><!-- PAGE CONTENT ENDS -->
              </div><!-- /.col -->
            </div><!-- /.row -->
          </div><!-- /.page-content -->
        </div>
      </div><!-- /.main-content -->

     <include file="Public/footer" />
      <!-- ./footer -->

      <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
        <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
      </a>
    </div><!-- /.main-container -->

    <!-- basic scripts -->

    <!--[if !IE]> -->
    <script src="__PUBLIC__/Admin/assets/js/jquery-2.1.4.min.js"></script>

    <!-- <![endif]-->

    <!--[if IE]>
<script src="__PUBLIC__/Admin/assets/js/jquery-1.11.3.min.js"></script>
<![endif]-->
    <script type="text/javascript">
      if('ontouchstart' in document.documentElement) document.write("<script src='__PUBLIC__/Admin/assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
    </script>
    <script src="__PUBLIC__/Admin/assets/js/bootstrap.min.js"></script>

    <!-- page specific plugin scripts -->

    <!--[if lte IE 8]>
      <script src="__PUBLIC__/Admin/assets/js/excanvas.min.js"></script>
    <![endif]-->
    <script src="__PUBLIC__/Admin/assets/js/jquery-ui.custom.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/jquery.ui.touch-punch.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/chosen.jquery.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/spinbox.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/bootstrap-datepicker.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/bootstrap-timepicker.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/moment.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/daterangepicker.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/bootstrap-datetimepicker.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/bootstrap-colorpicker.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/jquery.knob.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/autosize.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/jquery.inputlimiter.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/jquery.maskedinput.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/bootstrap-tag.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/markdown.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/bootstrap-markdown.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/jquery.hotkeys.index.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/bootstrap-wysiwyg.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/bootbox.js"></script>
    <!-- ace scripts -->
    <script src="__PUBLIC__/Admin/assets/js/ace-elements.min.js"></script>
    <script src="__PUBLIC__/Admin/assets/js/ace.min.js"></script>

    <!-- inline scripts related to this page -->
    <script type="text/javascript">
      jQuery(function($) {
        $('#id-disable-check').on('click', function() {
          var inp = $('#form-input-readonly').get(0);
          if(inp.hasAttribute('disabled')) {
            inp.setAttribute('readonly' , 'true');
            inp.removeAttribute('disabled');
            inp.value="This text field is readonly!";
          }
          else {
            inp.setAttribute('disabled' , 'disabled');
            inp.removeAttribute('readonly');
            inp.value="This text field is disabled!";
          }
        });
      
      
        if(!ace.vars['touch']) {
          $('.chosen-select').chosen({allow_single_deselect:true}); 
          //resize the chosen on window resize
      
          $(window)
          .off('resize.chosen')
          .on('resize.chosen', function() {
            $('.chosen-select').each(function() {
               var $this = $(this);
               $this.next().css({'width': $this.parent().width()});
            })
          }).trigger('resize.chosen');
          //resize chosen on sidebar collapse/expand
          $(document).on('settings.ace.chosen', function(e, event_name, event_val) {
            if(event_name != 'sidebar_collapsed') return;
            $('.chosen-select').each(function() {
               var $this = $(this);
               $this.next().css({'width': $this.parent().width()});
            })
          });
      
      
          $('#chosen-multiple-style .btn').on('click', function(e){
            var target = $(this).find('input[type=radio]');
            var which = parseInt(target.val());
            if(which == 2) $('#form-field-select-4').addClass('tag-input-style');
             else $('#form-field-select-4').removeClass('tag-input-style');
          });
        }
      
      
        $('[data-rel=tooltip]').tooltip({container:'body'});
        $('[data-rel=popover]').popover({container:'body'});
      
        autosize($('textarea[class*=autosize]'));
        
        $('textarea.limited').inputlimiter({
          remText: '%n character%s remaining...',
          limitText: 'max allowed : %n.'
        });
      
        $.mask.definitions['~']='[+-]';
        $('.input-mask-date').mask('99/99/9999');
        $('.input-mask-phone').mask('(999) 999-9999');
        $('.input-mask-eyescript').mask('~9.99 ~9.99 999');
        $(".input-mask-product").mask("a*-999-a999",{placeholder:" ",completed:function(){alert("You typed the following: "+this.val());}});
      
      
      
        $( "#input-size-slider" ).css('width','200px').slider({
          value:1,
          range: "min",
          min: 1,
          max: 8,
          step: 1,
          slide: function( event, ui ) {
            var sizing = ['', 'input-sm', 'input-lg', 'input-mini', 'input-small', 'input-medium', 'input-large', 'input-xlarge', 'input-xxlarge'];
            var val = parseInt(ui.value);
            $('#form-field-4').attr('class', sizing[val]).attr('placeholder', '.'+sizing[val]);
          }
        });
      
        $( "#input-span-slider" ).slider({
          value:1,
          range: "min",
          min: 1,
          max: 12,
          step: 1,
          slide: function( event, ui ) {
            var val = parseInt(ui.value);
            $('#form-field-5').attr('class', 'col-xs-'+val).val('.col-xs-'+val);
          }
        });
      
      
        
        //"jQuery UI Slider"
        //range slider tooltip example
        $( "#slider-range" ).css('height','200px').slider({
          orientation: "vertical",
          range: true,
          min: 0,
          max: 100,
          values: [ 17, 67 ],
          slide: function( event, ui ) {
            var val = ui.values[$(ui.handle).index()-1] + "";
      
            if( !ui.handle.firstChild ) {
              $("<div class='tooltip right in' style='display:none;left:16px;top:-6px;'><div class='tooltip-arrow'></div><div class='tooltip-inner'></div></div>")
              .prependTo(ui.handle);
            }
            $(ui.handle.firstChild).show().children().eq(1).text(val);
          }
        }).find('span.ui-slider-handle').on('blur', function(){
          $(this.firstChild).hide();
        });
        
        
        $( "#slider-range-max" ).slider({
          range: "max",
          min: 1,
          max: 10,
          value: 2
        });
        
        $( "#slider-eq > span" ).css({width:'90%', 'float':'left', margin:'15px'}).each(function() {
          // read initial values from markup and remove that
          var value = parseInt( $( this ).text(), 10 );
          $( this ).empty().slider({
            value: value,
            range: "min",
            animate: true
            
          });
        });
        
        $("#slider-eq > span.ui-slider-purple").slider('disable');//disable third item
      
        
        $('#id-input-file-1 , #id-input-file-2').ace_file_input({
          no_file:'No File ...',
          btn_choose:'Choose',
          btn_change:'Change',
          droppable:false,
          onchange:null,
          thumbnail:false //| true | large
          //whitelist:'gif|png|jpg|jpeg'
          //blacklist:'exe|php'
          //onchange:''
          //
        });
        //pre-show a file name, for example a previously selected file
        //$('#id-input-file-1').ace_file_input('show_file_list', ['myfile.txt'])
      
      
        $('#id-input-file-3').ace_file_input({
          style: 'well',
          btn_choose: 'Drop files here or click to choose',
          btn_change: null,
          no_icon: 'ace-icon fa fa-cloud-upload',
          droppable: true,
          thumbnail: 'small'//large | fit
          //,icon_remove:null//set null, to hide remove/reset button
          /**,before_change:function(files, dropped) {
            //Check an example below
            //or examples/file-upload.html
            return true;
          }*/
          /**,before_remove : function() {
            return true;
          }*/
          ,
          preview_error : function(filename, error_code) {
            //name of the file that failed
            //error_code values
            //1 = 'FILE_LOAD_FAILED',
            //2 = 'IMAGE_LOAD_FAILED',
            //3 = 'THUMBNAIL_FAILED'
            //alert(error_code);
          }
      
        }).on('change', function(){
          //console.log($(this).data('ace_input_files'));
          //console.log($(this).data('ace_input_method'));
        });
        
        
        //$('#id-input-file-3')
        //.ace_file_input('show_file_list', [
          //{type: 'image', name: 'name of image', path: 'http://path/to/image/for/preview'},
          //{type: 'file', name: 'hello.txt'}
        //]);
      
        
        
      
        //dynamically change allowed formats by changing allowExt && allowMime function
        $('#id-file-format').removeAttr('checked').on('change', function() {
          var whitelist_ext, whitelist_mime;
          var btn_choose
          var no_icon
          if(this.checked) {
            btn_choose = "Drop images here or click to choose";
            no_icon = "ace-icon fa fa-picture-o";
      
            whitelist_ext = ["jpeg", "jpg", "png", "gif" , "bmp"];
            whitelist_mime = ["image/jpg", "image/jpeg", "image/png", "image/gif", "image/bmp"];
          }
          else {
            btn_choose = "Drop files here or click to choose";
            no_icon = "ace-icon fa fa-cloud-upload";
            
            whitelist_ext = null;//all extensions are acceptable
            whitelist_mime = null;//all mimes are acceptable
          }
          var file_input = $('#id-input-file-3');
          file_input
          .ace_file_input('update_settings',
          {
            'btn_choose': btn_choose,
            'no_icon': no_icon,
            'allowExt': whitelist_ext,
            'allowMime': whitelist_mime
          })
          file_input.ace_file_input('reset_input');
          
          file_input
          .off('file.error.ace')
          .on('file.error.ace', function(e, info) {
            //console.log(info.file_count);//number of selected files
            //console.log(info.invalid_count);//number of invalid files
            //console.log(info.error_list);//a list of errors in the following format
            
            //info.error_count['ext']
            //info.error_count['mime']
            //info.error_count['size']
            
            //info.error_list['ext']  = [list of file names with invalid extension]
            //info.error_list['mime'] = [list of file names with invalid mimetype]
            //info.error_list['size'] = [list of file names with invalid size]
            
            
            /**
            if( !info.dropped ) {
              //perhapse reset file field if files have been selected, and there are invalid files among them
              //when files are dropped, only valid files will be added to our file array
              e.preventDefault();//it will rest input
            }
            */
            
            
            //if files have been selected (not dropped), you can choose to reset input
            //because browser keeps all selected files anyway and this cannot be changed
            //we can only reset file field to become empty again
            //on any case you still should check files with your server side script
            //because any arbitrary file can be uploaded by user and it's not safe to rely on browser-side measures
          });
          
          
          /**
          file_input
          .off('file.preview.ace')
          .on('file.preview.ace', function(e, info) {
            console.log(info.file.width);
            console.log(info.file.height);
            e.preventDefault();//to prevent preview
          });
          */
        
        });
      
        $('#spinner1').ace_spinner({value:0,min:0,max:250,step:10, btn_up_class:'btn-info' , btn_down_class:'btn-info'})
        .closest('.ace-spinner')
        .on('changed.fu.spinbox', function(){
          //console.log($('#spinner1').val())
        }); 
        $('#spinner2').ace_spinner({value:0,min:0,max:10000,step:100, touch_spinner: true, icon_up:'ace-icon fa fa-caret-up bigger-110', icon_down:'ace-icon fa fa-caret-down bigger-110'});
        $('#spinner3').ace_spinner({value:0,min:-100,max:100,step:10, on_sides: true, icon_up:'ace-icon fa fa-plus bigger-110', icon_down:'ace-icon fa fa-minus bigger-110', btn_up_class:'btn-success' , btn_down_class:'btn-danger'});
        $('#spinner4').ace_spinner({value:0,min:-100,max:100,step:10, on_sides: true, icon_up:'ace-icon fa fa-plus', icon_down:'ace-icon fa fa-minus', btn_up_class:'btn-purple' , btn_down_class:'btn-purple'});
      
        //$('#spinner1').ace_spinner('disable').ace_spinner('value', 11);
        //or
        //$('#spinner1').closest('.ace-spinner').spinner('disable').spinner('enable').spinner('value', 11);//disable, enable or change value
        //$('#spinner1').closest('.ace-spinner').spinner('value', 0);//reset to 0
      
      
        //datepicker plugin
        //link
        $('.date-picker').datepicker({
          autoclose: true,
          todayHighlight: true
        })
        //show datepicker when clicking on the icon
        .next().on(ace.click_event, function(){
          $(this).prev().focus();
        });
      
        //or change it into a date range picker
        $('.input-daterange').datepicker({autoclose:true});
      
      
        //to translate the daterange picker, please copy the "examples/daterange-fr.js" contents here before initialization
        $('input[name=date-range-picker]').daterangepicker({
          'applyClass' : 'btn-sm btn-success',
          'cancelClass' : 'btn-sm btn-default',
          locale: {
            applyLabel: 'Apply',
            cancelLabel: 'Cancel',
          }
        })
        .prev().on(ace.click_event, function(){
          $(this).next().focus();
        });
      
      
        $('#timepicker1').timepicker({
          minuteStep: 1,
          showSeconds: true,
          showMeridian: false,
          disableFocus: true,
          icons: {
            up: 'fa fa-chevron-up',
            down: 'fa fa-chevron-down'
          }
        }).on('focus', function() {
          $('#timepicker1').timepicker('showWidget');
        }).next().on(ace.click_event, function(){
          $(this).prev().focus();
        });
        
        
      
        
        if(!ace.vars['old_ie']) $('#date-timepicker1').datetimepicker({
         //format: 'MM/DD/YYYY h:mm:ss A',//use this option to display seconds
         icons: {
          time: 'fa fa-clock-o',
          date: 'fa fa-calendar',
          up: 'fa fa-chevron-up',
          down: 'fa fa-chevron-down',
          previous: 'fa fa-chevron-left',
          next: 'fa fa-chevron-right',
          today: 'fa fa-arrows ',
          clear: 'fa fa-trash',
          close: 'fa fa-times'
         }
        }).next().on(ace.click_event, function(){
          $(this).prev().focus();
        });
        
      
        $('#colorpicker1').colorpicker();
        //$('.colorpicker').last().css('z-index', 2000);//if colorpicker is inside a modal, its z-index should be higher than modal'safe
      
        $('#simple-colorpicker-1').ace_colorpicker();
        //$('#simple-colorpicker-1').ace_colorpicker('pick', 2);//select 2nd color
        //$('#simple-colorpicker-1').ace_colorpicker('pick', '#fbe983');//select #fbe983 color
        //var picker = $('#simple-colorpicker-1').data('ace_colorpicker')
        //picker.pick('red', true);//insert the color if it doesn't exist
      
      
        $(".knob").knob();
        
        
        var tag_input = $('#form-field-tags');
        try{
          tag_input.tag(
            {
            placeholder:tag_input.attr('placeholder'),
            //enable typeahead by specifying the source array
            source: ace.vars['US_STATES'],//defined in ace.js >> ace.enable_search_ahead
            /**
            //or fetch data from database, fetch those that match "query"
            source: function(query, process) {
              $.ajax({url: 'remote_source.php?q='+encodeURIComponent(query)})
              .done(function(result_items){
              process(result_items);
              });
            }
            */
            }
          )
      
          //programmatically add/remove a tag
          var $tag_obj = $('#form-field-tags').data('tag');
          $tag_obj.add('Programmatically Added');
          
          var index = $tag_obj.inValues('some tag');
          $tag_obj.remove(index);
        }
        catch(e) {
          //display a textarea for old IE, because it doesn't support this plugin or another one I tried!
          tag_input.after('<textarea id="'+tag_input.attr('id')+'" name="'+tag_input.attr('name')+'" rows="3">'+tag_input.val()+'</textarea>').remove();
          //autosize($('#form-field-tags'));
        }
        
        
        /////////
        $('#modal-form input[type=file]').ace_file_input({
          style:'well',
          btn_choose:'Drop files here or click to choose',
          btn_change:null,
          no_icon:'ace-icon fa fa-cloud-upload',
          droppable:true,
          thumbnail:'large'
        })
        
        //chosen plugin inside a modal will have a zero width because the select element is originally hidden
        //and its width cannot be determined.
        //so we set the width after modal is show
        $('#modal-form').on('shown.bs.modal', function () {
          if(!ace.vars['touch']) {
            $(this).find('.chosen-container').each(function(){
              $(this).find('a:first-child').css('width' , '210px');
              $(this).find('.chosen-drop').css('width' , '210px');
              $(this).find('.chosen-search input').css('width' , '200px');
            });
          }
        })
        /**
        //or you can activate the chosen plugin after modal is shown
        //this way select element becomes visible with dimensions and chosen works as expected
        $('#modal-form').on('shown', function () {
          $(this).find('.modal-chosen').chosen();
        })
        */
      
        
        
        $(document).one('ajaxloadstart.page', function(e) {
          autosize.destroy('textarea[class*=autosize]')
          
          $('.limiterBox,.autosizejs').remove();
          $('.daterangepicker.dropdown-menu,.colorpicker.dropdown-menu,.bootstrap-datetimepicker-widget.dropdown-menu').remove();
        });
      
      });
    </script>
    <!-- inline scripts related to this page -->
    <script type="text/javascript">
      jQuery(function($){
  
  $('textarea[data-provide="markdown"]').each(function(){
        var $this = $(this);

    if ($this.data('markdown')) {
      $this.data('markdown').showEditor();
    }
    else $this.markdown()
    
    $this.parent().find('.btn').addClass('btn-white');
    })
  
  
  
  function showErrorAlert (reason, detail) {
    var msg='';
    if (reason==='unsupported-file-type') { msg = "Unsupported format " +detail; }
    else {
      //console.log("error uploading file", reason, detail);
    }
    $('<div class="alert"> <button type="button" class="close" data-dismiss="alert">&times;</button>'+ 
     '<strong>File upload error</strong> '+msg+' </div>').prependTo('#alerts');
  }

  //$('#editor1').ace_wysiwyg();//this will create the default editor will all buttons

  //but we want to change a few buttons colors for the third style
  $('#editor1').ace_wysiwyg({
    toolbar:
    [
      'font',
      null,
      'fontSize',
      null,
      {name:'bold', className:'btn-info'},
      {name:'italic', className:'btn-info'},
      {name:'strikethrough', className:'btn-info'},
      {name:'underline', className:'btn-info'},
      null,
      {name:'insertunorderedlist', className:'btn-success'},
      {name:'insertorderedlist', className:'btn-success'},
      {name:'outdent', className:'btn-purple'},
      {name:'indent', className:'btn-purple'},
      null,
      {name:'justifyleft', className:'btn-primary'},
      {name:'justifycenter', className:'btn-primary'},
      {name:'justifyright', className:'btn-primary'},
      {name:'justifyfull', className:'btn-inverse'},
      null,
      {name:'createLink', className:'btn-pink'},
      {name:'unlink', className:'btn-pink'},
      null,
      {name:'insertImage', className:'btn-success'},
      null,
      'foreColor',
      null,
      {name:'undo', className:'btn-grey'},
      {name:'redo', className:'btn-grey'}
    ],
    'wysiwyg': {
      fileUploadError: showErrorAlert
    }
  }).prev().addClass('wysiwyg-style2');

  
  /**
  //make the editor have all the available height
  $(window).on('resize.editor', function() {
    var offset = $('#editor1').parent().offset();
    var winHeight =  $(this).height();
    
    $('#editor1').css({'height':winHeight - offset.top - 10, 'max-height': 'none'});
  }).triggerHandler('resize.editor');
  */
  

  $('#editor2').css({'height':'200px'}).ace_wysiwyg({
    toolbar_place: function(toolbar) {
      return $(this).closest('.widget-box')
             .find('.widget-header').prepend(toolbar)
           .find('.wysiwyg-toolbar').addClass('inline');
    },
    toolbar:
    [
      'bold',
      {name:'italic' , title:'Change Title!', icon: 'ace-icon fa fa-leaf'},
      'strikethrough',
      null,
      'insertunorderedlist',
      'insertorderedlist',
      null,
      'justifyleft',
      'justifycenter',
      'justifyright'
    ],
    speech_button: false
  });
  
  


  $('[data-toggle="buttons"] .btn').on('click', function(e){
    var target = $(this).find('input[type=radio]');
    var which = parseInt(target.val());
    var toolbar = $('#editor1').prev().get(0);
    if(which >= 1 && which <= 4) {
      toolbar.className = toolbar.className.replace(/wysiwyg\-style(1|2)/g , '');
      if(which == 1) $(toolbar).addClass('wysiwyg-style1');
      else if(which == 2) $(toolbar).addClass('wysiwyg-style2');
      if(which == 4) {
        $(toolbar).find('.btn-group > .btn').addClass('btn-white btn-round');
      } else $(toolbar).find('.btn-group > .btn-white').removeClass('btn-white btn-round');
    }
  });


  

  //RESIZE IMAGE
  
  //Add Image Resize Functionality to Chrome and Safari
  //webkit browsers don't have image resize functionality when content is editable
  //so let's add something using jQuery UI resizable
  //another option would be opening a dialog for user to enter dimensions.
  if ( typeof jQuery.ui !== 'undefined' && ace.vars['webkit'] ) {
    
    var lastResizableImg = null;
    function destroyResizable() {
      if(lastResizableImg == null) return;
      lastResizableImg.resizable( "destroy" );
      lastResizableImg.removeData('resizable');
      lastResizableImg = null;
    }

    var enableImageResize = function() {
      $('.wysiwyg-editor')
      .on('mousedown', function(e) {
        var target = $(e.target);
        if( e.target instanceof HTMLImageElement ) {
          if( !target.data('resizable') ) {
            target.resizable({
              aspectRatio: e.target.width / e.target.height,
            });
            target.data('resizable', true);
            
            if( lastResizableImg != null ) {
              //disable previous resizable image
              lastResizableImg.resizable( "destroy" );
              lastResizableImg.removeData('resizable');
            }
            lastResizableImg = target;
          }
        }
      })
      .on('click', function(e) {
        if( lastResizableImg != null && !(e.target instanceof HTMLImageElement) ) {
          destroyResizable();
        }
      })
      .on('keydown', function() {
        destroyResizable();
      });
      }

    enableImageResize();

    /**
    //or we can load the jQuery UI dynamically only if needed
    if (typeof jQuery.ui !== 'undefined') enableImageResize();
    else {//load jQuery UI if not loaded
      //in Ace demo ./components will be replaced by correct components path
      $.getScript("__PUBLIC__/Admin/assets/js/jquery-ui.custom.min.js", function(data, textStatus, jqxhr) {
        enableImageResize()
      });
    }
    */
  }


});
    </script>
        <!-- inline scripts related to this page -->
    <script type="text/javascript">
      jQuery(function($) {
      
        $( "#datepicker" ).datepicker({
          showOtherMonths: true,
          selectOtherMonths: false,
          //isRTL:true,
      
          
          /*
          changeMonth: true,
          changeYear: true,
          
          showButtonPanel: true,
          beforeShow: function() {
            //change button colors
            var datepicker = $(this).datepicker( "widget" );
            setTimeout(function(){
              var buttons = datepicker.find('.ui-datepicker-buttonpane')
              .find('button');
              buttons.eq(0).addClass('btn btn-xs');
              buttons.eq(1).addClass('btn btn-xs btn-success');
              buttons.wrapInner('<span class="bigger-110" />');
            }, 0);
          }
      */
        });
      
      
        //override dialog's title function to allow for HTML titles
        $.widget("ui.dialog", $.extend({}, $.ui.dialog.prototype, {
          _title: function(title) {
            var $title = this.options.title || '&nbsp;'
            if( ("title_html" in this.options) && this.options.title_html == true )
              title.html($title);
            else title.text($title);
          }
        }));
      
        $( "#id-btn-dialog1" ).on('click', function(e) {
          e.preventDefault();
      
          var dialog = $( "#dialog-message" ).removeClass('hide').dialog({
            modal: true,
            title: "<div class='widget-header widget-header-small'><h4 class='smaller'><i class='ace-icon fa fa-check'></i> jQuery UI Dialog</h4></div>",
            title_html: true,
            buttons: [ 
              {
                text: "Cancel",
                "class" : "btn btn-minier",
                click: function() {
                  $( this ).dialog( "close" ); 
                } 
              },
              {
                text: "OK",
                "class" : "btn btn-primary btn-minier",
                click: function() {
                  $( this ).dialog( "close" ); 
                } 
              }
            ]
          });
      
          /**
          dialog.data( "uiDialog" )._title = function(title) {
            title.html( this.options.title );
          };
          **/
        });
      
      
        $( "#id-btn-dialog2" ).on('click', function(e) {
          e.preventDefault();
        
          $( "#dialog-confirm" ).removeClass('hide').dialog({
            resizable: false,
            width: '320',
            modal: true,
            title: "<div class='widget-header'><h4 class='smaller'><i class='ace-icon fa fa-exclamation-triangle red'></i>  清空回收站？</h4></div>",
            title_html: true,
            buttons: [
              {
                html: "<i class='ace-icon fa fa-trash-o bigger-110'></i>&nbsp;删除",
                "class" : "btn btn-danger btn-minier",
                click: function() {
                  $( this ).dialog( "close" );
                }
              }
              ,
              {
                html: "<i class='ace-icon fa fa-times bigger-110'></i>&nbsp; 取消",
                "class" : "btn btn-minier",
                click: function() {
                  $( this ).dialog( "close" );
                }
              }
            ]
          });
        });
      
      
        
        //autocomplete
         var availableTags = [
          "ActionScript",
          "AppleScript",
          "Asp",
          "BASIC",
          "C",
          "C++",
          "Clojure",
          "COBOL",
          "ColdFusion",
          "Erlang",
          "Fortran",
          "Groovy",
          "Haskell",
          "Java",
          "JavaScript",
          "Lisp",
          "Perl",
          "PHP",
          "Python",
          "Ruby",
          "Scala",
          "Scheme"
        ];
        $( "#tags" ).autocomplete({
          source: availableTags
        });
      
        //custom autocomplete (category selection)
        $.widget( "custom.catcomplete", $.ui.autocomplete, {
          _create: function() {
            this._super();
            this.widget().menu( "option", "items", "> :not(.ui-autocomplete-category)" );
          },
          _renderMenu: function( ul, items ) {
            var that = this,
            currentCategory = "";
            $.each( items, function( index, item ) {
              var li;
              if ( item.category != currentCategory ) {
                ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" );
                currentCategory = item.category;
              }
              li = that._renderItemData( ul, item );
                if ( item.category ) {
                li.attr( "aria-label", item.category + " : " + item.label );
              }
            });
          }
        });
        
         var data = [
          { label: "anders", category: "" },
          { label: "andreas", category: "" },
          { label: "antal", category: "" },
          { label: "annhhx10", category: "Products" },
          { label: "annk K12", category: "Products" },
          { label: "annttop C13", category: "Products" },
          { label: "anders andersson", category: "People" },
          { label: "andreas andersson", category: "People" },
          { label: "andreas johnson", category: "People" }
        ];
        $( "#search" ).catcomplete({
          delay: 0,
          source: data
        });
        
        
        //tooltips
        $( "#show-option" ).tooltip({
          show: {
            effect: "slideDown",
            delay: 250
          }
        });
      
        $( "#hide-option" ).tooltip({
          hide: {
            effect: "explode",
            delay: 250
          }
        });
      
        $( "#open-event" ).tooltip({
          show: null,
          position: {
            my: "left top",
            at: "left bottom"
          },
          open: function( event, ui ) {
            ui.tooltip.animate({ top: ui.tooltip.position().top + 10 }, "fast" );
          }
        });
      
      
        //Menu
        $( "#menu" ).menu();
      
      
        //spinner
        var spinner = $( "#spinner" ).spinner({
          create: function( event, ui ) {
            //add custom classes and icons
            $(this)
            .next().addClass('btn btn-success').html('<i class="ace-icon fa fa-plus"></i>')
            .next().addClass('btn btn-danger').html('<i class="ace-icon fa fa-minus"></i>')
            
            //larger buttons on touch devices
            if('touchstart' in document.documentElement) 
              $(this).closest('.ui-spinner').addClass('ui-spinner-touch');
          }
        });
      
        //slider example
        $( "#slider" ).slider({
          range: true,
          min: 0,
          max: 500,
          values: [ 75, 300 ]
        });
      
      
      
        //jquery accordion
        $( "#accordion" ).accordion({
          collapsible: true ,
          heightStyle: "content",
          animate: 250,
          header: ".accordion-header"
        }).sortable({
          axis: "y",
          handle: ".accordion-header",
          stop: function( event, ui ) {
            // IE doesn't register the blur when sorting
            // so trigger focusout handlers to remove .ui-state-focus
            ui.item.children( ".accordion-header" ).triggerHandler( "focusout" );
          }
        });
        //jquery tabs
        $( "#tabs" ).tabs();
        
        
        //progressbar
        $( "#progressbar" ).progressbar({
          value: 37,
          create: function( event, ui ) {
            $(this).addClass('progress progress-striped active')
                 .children(0).addClass('progress-bar progress-bar-success');
          }
        });
      
        
        //selectmenu
         $( "#number" ).css('width', '200px')
        .selectmenu({ position: { my : "left bottom", at: "left top" } })
          
      });
    </script>
      <!-- 自定义js -->
      <script type="text/javascript">
        $("#article-add").submit(function(){
            // 可以过滤一下是否为空
            
            // 同步你 DIV 的值到隐藏域
            var content = $("#editor1").html();
            $("input[name=article_content]").val(content);
            
            // 提交
            return true;
        });
    </script>
  </body>
</html>
